package com.enqualcomm.kids.bean;


import android.app.Activity;

import com.enqualcomm.kids.R;

/**
 * Created by yinzhiqun on 2016/2/25.
 */
public class Constellation {
    public String name;
    public int imageId;
    public int bigImageId;
    public String duration;
    public int backgroundId;
    public int tokenImageId;
    public String luckNum;
    public String luckFlower;
    public String desc;

    private Constellation() {
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setTokenImageId(int tokenImageId) {
        this.tokenImageId = tokenImageId;
    }

    public void setImageId(int imageId) {
        this.imageId = imageId;
    }

    public void setBigImageId(int bigImageId) {
        this.bigImageId = bigImageId;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public void setBackgroundId(int backgroundId) {
        this.backgroundId = backgroundId;
    }

    public void setLuckNum(String luckNum) {
        this.luckNum = luckNum;
    }

    public void setLuckFlower(String luckFlower) {
        this.luckFlower = luckFlower;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    //    private static SparseArray<Constellation> instances = new SparseArray<Constellation>();
//    static {
//        instances.put(1,new Constellation("白羊座", R.drawable.constellation_baiyang));
//        instances.put(2,new Constellation("金牛座", R.drawable.constellation_jinniu));
//        instances.put(3,new Constellation("双子座", R.drawable.constellation_shuangzi));
//        instances.put(4,new Constellation("巨蟹座", R.drawable.constellation_juxie));
//        instances.put(5,new Constellation("狮子座", R.drawable.constellation_shizi));
//        instances.put(6,new Constellation("处女座", R.drawable.constellation_chunv));
//        instances.put(7,new Constellation("天秤座", R.drawable.constellation_tianchen));
//        instances.put(8,new Constellation("天蝎座", R.drawable.constellation_tianxie));
//        instances.put(9,new Constellation("射手座", R.drawable.constellation_sheshou));
//        instances.put(10,new Constellation("摩羯座", R.drawable.constellation_mojie));
//        instances.put(11,new Constellation("水瓶座", R.drawable.constellation_shuiping));
//        instances.put(12,new Constellation("双鱼座", R.drawable.constellation_shuangyu));
//    }

    public static Constellation getInstance(Activity ac, int month, int day) {
        int index = 0;
        switch (month) {
            case 3:
                index = day > 20 ? 1 : 12;
                break;
            case 4:
                index = day > 19 ? 2 : 1;
                break;
            case 5:
                index = day > 20 ? 3 : 2;
                break;
            case 6:
                index = day > 21 ? 4 : 3;
                break;
            case 7:
                index = day > 22 ? 5 : 4;
                break;
            case 8:
                index = day > 22 ? 6 : 5;
                break;
            case 9:
                index = day > 22 ? 7 : 6;
                break;
            case 10:
                index = day > 23 ? 8 : 7;
                break;
            case 11:
                index = day > 22 ? 9 : 8;
                break;
            case 12:
                index = day > 21 ? 10 : 9;
                break;
            case 1:
                index = day > 19 ? 11 : 10;
                break;
            case 2:
                index = day > 18 ? 12 : 11;
                break;
        }

        if (index == 0) {
            return null;
        }
        return createInstance(ac,index);
    }

    private static Constellation createInstance(Activity ac,int index) {
        Constellation constellation = null;

        switch (index) {
            case 3:
                constellation = new Constellation();
                constellation.setName(ac.getString(R.string.star_gemini));
                constellation.setImageId(R.drawable.constellation_shuangzi);
                constellation.setBigImageId(R.drawable.constellation_shuangzi_big);
                constellation.setBackgroundId(R.drawable.constellation_shuangzi_bg);
                constellation.setTokenImageId(R.drawable.constellation_shuangzi_token);
                constellation.setDuration(ac.getString(R.string.shuangzi_content_3));
                constellation.setLuckNum("5、14、23、32");
                constellation.setLuckFlower(ac.getString(R.string.shuangzi_content_2));
                constellation.setDesc(ac.getString(R.string.shuangzi_content_1));
                break;
            case 4:
                constellation = new Constellation();
                constellation.setName(ac.getString(R.string.star_cancer));
                constellation.setImageId(R.drawable.constellation_juxie);
                constellation.setBigImageId(R.drawable.constellation_juxie_big);
                constellation.setBackgroundId(R.drawable.constellation_juxie_bg);
                constellation.setTokenImageId(R.drawable.constellation_juxie_token);
                constellation.setDuration(ac.getString(R.string.juxie_content_3));
                constellation.setLuckNum("2、11、20、29");
                constellation.setLuckFlower(ac.getString(R.string.juxie_content_2));
                constellation.setDesc(ac.getString(R.string.juxie_content_1));
                break;
            case 5:
                constellation = new Constellation();
                constellation.setName(ac.getString(R.string.star_leo));
                constellation.setImageId(R.drawable.constellation_shizi);
                constellation.setBigImageId(R.drawable.constellation_shizi_big);
                constellation.setBackgroundId(R.drawable.constellation_shizi_bg);
                constellation.setTokenImageId(R.drawable.constellation_shizi_token);
                constellation.setDuration(ac.getString(R.string.shizi_content_3));
                constellation.setLuckNum("1、10、19、28");
                constellation.setLuckFlower(ac.getString(R.string.shizi_content_2));
                constellation.setDesc(ac.getString(R.string.shizi_content_1));
                break;
            case 6:
                constellation = new Constellation();
                constellation.setName(ac.getString(R.string.star_virgo));
                constellation.setImageId(R.drawable.constellation_chunv);
                constellation.setBigImageId(R.drawable.constellation_hunv_big);
                constellation.setBackgroundId(R.drawable.constellation_hunv_bg);
                constellation.setTokenImageId(R.drawable.constellation_hunv_token);
                constellation.setDuration(ac.getString(R.string.chunv_content_3));
                constellation.setLuckNum("5、14、23、32");
                constellation.setLuckFlower(ac.getString(R.string.chunv_content_2));
                constellation.setDesc(ac.getString(R.string.chunv_content_1));
                break;
            case 7:
                constellation = new Constellation();
                constellation.setName(ac.getString(R.string.star_libra));
                constellation.setImageId(R.drawable.constellation_tianchen);
                constellation.setBigImageId(R.drawable.constellation_tianchen_big);
                constellation.setBackgroundId(R.drawable.constellation_tianchen_bg);
                constellation.setTokenImageId(R.drawable.constellation_tianchen_token);
                constellation.setDuration(ac.getString(R.string.tianping_content_3));
                constellation.setLuckNum("6、15、24、33");
                constellation.setLuckFlower(ac.getString(R.string.tianping_content_2));
                constellation.setDesc(ac.getString(R.string.tianping_content_1));
                break;
            case 8:
                constellation = new Constellation();
                constellation.setName(ac.getString(R.string.star_scorpio));
                constellation.setImageId(R.drawable.constellation_tianxie);
                constellation.setBigImageId(R.drawable.constellation_tianxie_big);
                constellation.setBackgroundId(R.drawable.constellation_tianxie_bg);
                constellation.setTokenImageId(R.drawable.constellation_tianxie_token);
                constellation.setDuration(ac.getString(R.string.tianxie_content_3));
                constellation.setLuckNum("9、18、27、36");
                constellation.setLuckFlower(ac.getString(R.string.tianxie_content_2));
                constellation.setDesc(ac.getString(R.string.tianxie_content_1));
                break;
            case 9:
                constellation = new Constellation();
                constellation.setName(ac.getString(R.string.star_Sagittarius));
                constellation.setImageId(R.drawable.constellation_sheshou);
                constellation.setBigImageId(R.drawable.constellation_sheshou_big);
                constellation.setBackgroundId(R.drawable.constellation_sheshou_bg);
                constellation.setTokenImageId(R.drawable.constellation_sheshou_token);
                constellation.setDuration(ac.getString(R.string.sheshou_content_3));
                constellation.setLuckNum("3、12、21、30");
                constellation.setLuckFlower(ac.getString(R.string.sheshou_content_2));
                constellation.setDesc(ac.getString(R.string.sheshou_content_1));
                break;
            case 10:
                constellation = new Constellation();
                constellation.setName(ac.getString(R.string.star_capricorn));
                constellation.setImageId(R.drawable.constellation_mojie);
                constellation.setBigImageId(R.drawable.constellation_mojie_big);
                constellation.setBackgroundId(R.drawable.constellation_mojie_bg);
                constellation.setTokenImageId(R.drawable.constellation_mojie_token);
                constellation.setDuration(ac.getString(R.string.mojie_content_3));
                constellation.setLuckNum("8、16、26、35");
                constellation.setLuckFlower(ac.getString(R.string.mojie_cotent_2));
                constellation.setDesc(ac.getString(R.string.mojie_content_1));
                break;
            case 11:
                constellation = new Constellation();
                constellation.setName(ac.getString(R.string.star_aquarius));
                constellation.setImageId(R.drawable.constellation_shuiping);
                constellation.setBigImageId(R.drawable.constellation_shuiping_big);
                constellation.setBackgroundId(R.drawable.constellation_shuiping_bg);
                constellation.setTokenImageId(R.drawable.constellation_shuiping_token);
                constellation.setDuration(ac.getString(R.string.shuiping_content_3));
                constellation.setLuckNum("4、13、22、31");
                constellation.setLuckFlower(ac.getString(R.string.shuiping_content_2));
                constellation.setDesc(ac.getString(R.string.shuiping_content_1));
                break;
            case 12:
                constellation = new Constellation();
                constellation.setName(ac.getString(R.string.star_pisces));
                constellation.setImageId(R.drawable.constellation_shuangyu);
                constellation.setBigImageId(R.drawable.constellation_shuangyu_big);
                constellation.setBackgroundId(R.drawable.constellation_shuangyu_bg);
                constellation.setTokenImageId(R.drawable.constellation_shuangyu_token);
                constellation.setDuration(ac.getString(R.string.shuangyu_content_3));
                constellation.setLuckNum("7、16、25、34");
                constellation.setLuckFlower(ac.getString(R.string.shuangyu_content_2));
                constellation.setDesc(ac.getString(R.string.shuangyu_content_1));
                break;
            case 1:
                constellation = new Constellation();
                constellation.setName(ac.getString(R.string.star_aries));
                constellation.setImageId(R.drawable.constellation_baiyang);
                constellation.setBigImageId(R.drawable.constellation_baiyang_big);
                constellation.setBackgroundId(R.drawable.constellation_baiyang_bg);
                constellation.setTokenImageId(R.drawable.constellation_baiyang_token);
                constellation.setDuration(ac.getString(R.string.baiyang_content_3));
                constellation.setLuckNum("9、18、27、36");
                constellation.setLuckFlower(ac.getString(R.string.baiyang_content_2));
                constellation.setDesc(ac.getString(R.string.baiyang_content_1));
                break;
            case 2:
                constellation = new Constellation();
                constellation.setName(ac.getString(R.string.star_taurus));
                constellation.setImageId(R.drawable.constellation_jinniu);
                constellation.setBigImageId(R.drawable.constellation_jinniu_big);
                constellation.setBackgroundId(R.drawable.constellation_jinniu_bg);
                constellation.setTokenImageId(R.drawable.constellation_jinniu_token);
                constellation.setDuration(ac.getString(R.string.jinniu_content_3));
                constellation.setLuckNum("6、15、24、33");
                constellation.setLuckFlower(ac.getString(R.string.jinniu_content_2));
                constellation.setDesc(ac.getString(R.string.jinniu_content_1));
                break;
        }
        return constellation;
    }

}
